3. Performing a site collection backup
The next three recipes showcase SharePoint 2010's integrated granular backup and restore capability.
One content database can contain several site
collections. As the amount of data grows in an organization, the content
database grows quickly, along with the value of the information in a
site collection. It is the administrator's job to monitor this growth
and ensure the data is backed up at regular intervals.
There is a chance that the database either grows too
large or someone needs something restored from a particular site
collection.
To reduce the size of the content database, the
administrator can split off the information by site collection.
Splitting off the information by site collection, and parsing it out to
another physical content database, reduces the size of the existing
content database.
The other condition entails restoring the whole
content database from a backup. However, this is quite painful for every
site collection in that content database — the pain of restoring to a
point in time and the pain of downtime. Because of these two conditions
this may not be a viable option.
The best option, as the data in a site collection
matures, is to split the data from a site collection and put it into its
own content database. In this recipe, a site collection will be backed
up from a content database that contains more than one site collection.
Getting ready
You must have administrator privileges on the
SharePoint farm. You should also have a content database that contains
more than one site collection.
How to do it...
Open the Central Administration screen and click Backup and Restore.
The second section is Granular Backup. Under this section, click Perform a site collection backup.
The following page is displayed. Fill in the required details.
Click OK.
How it works...
This functionality is useful for backing up site
collections and its contents. This includes lists and content,
permissions, feature settings, and sites. This data is written to a file
that can be used in the restore action process.
When navigating to the backup page, there is a section called Readiness at the top. This shows any running instances of the backup. It also shows the timer service status.
Finally, after clicking OK, the process navigates the user to the Granular Backup Job Status page. This shows anything in process, along with any previous jobs that were run and the status of these jobs.
There's more...
PowerShell can be used to back up a site collection. The following is the command:
backup-spsite -identity http://domain/sites/scname -path \\server\backup\file.bak
More info
The Central Administration application pool account must have full access to the backup folder.
4. Exporting sites
SharePoint 2010 contains another component to the granular backup — the ability to export sites and lists.
The benefit of this in an administrator's toolbox is
the capability of moving content at a granular level. While users have
the capability of creating templates and saving data with their lists,
there is a limit to the size of templates. Administrators can move this
information, and can write scripts in PowerShell on what needs to be
done, for maximum efficiency.
In this recipe, we will export a site under a site collection.
Getting ready
You must have administrator privileges on the SharePoint farm. There must be a site created under the site collection.
How to do it...
Open the Central Administration screen and click Backup and Restore.
The second section is Granular Backup. Under this section, click Export a site or list.
The following page is displayed:
Fill in the required data.
Site Collection: Select the site collection where the site is located.
Site: Select the subsite from the drop-down list.
List: Leave at No selection.
File location: Enter a name for the file. Check the Overwrite... option if appropriate.
Export Full Security: Leave this unchecked.
Export Versions: Leave at All Versions.
Click OK.
How it works...
Export sites takes all the site objects including
installed features, files (pages and content), lists, and all child
sites and the associated content.
The administrator must choose an existing site collection and site. Leaving the List value at No selection, implies that we will be exporting all of the lists. Versions are a component of lists and have no bearing in the above recipe.
If a list is being exported, there are four options to choose from for versioning: All Versions, Last Major, Current Version, and Last Minor.
Finally, an export log is created in the directory
where the backup is located. This log shows all the assets that were
exported, along with the order in which they were exported. It will also
show an error if we try to overwrite a file that already exists, and if
the checkbox that allows the overwriting of files (Overwrite existing files) is not checked.
There's more...
PowerShell can be used to script the exports instead
of doing them one by one in Central Administration. The command for site
import is:
Export-SPWeb http://domain/sites/ts/teamsite -Path \\server\backup\file.bak
The command for item export using PowerShell is:
Export-SPWeb http://domain/sites/ts/teamsite -ItemURL "Lists/Announcements" -Path \\server\backup\file.bak